#include "Cell.h"

#include "Console.h"
#include "ParticleBase.h"

#include "LowLevel.h"
/*
using namespace ParticleEngine; 

Cell::Cell() :
	ParticleCount(0)
{
}
Cell::~Cell()
{
}
void Cell::AddParticleSave(ParticleBase* P0)
{
	Lock();
	if (ParticleCount < Cell_PARTICLE_MAXIMUM)
		Particles[ParticleCount++] = P0;
	else
		CONSOLE_WARNING("Cell overflow");
	Unlock();
}
void Cell::RemoveParticleSave(ParticleBase* P0)
{
	this->Lock();

	ASSUME(this->ParticleCount <= Cell_PARTICLE_MAXIMUM);
	for (size_t i = 0; i < this->ParticleCount; ++i)
		if (this->Particles[i] == P0)
		{
			this->ParticleCount--;
			if (i < (this->ParticleCount + 1))//Es muss sortiert werden wenn das eintrifft!
				this->Particles[i] = this->Particles[ParticleCount];
			this->Unlock();
			return;
		}
	this->Unlock();
}

void Cell::AddParticleUnsave(ParticleBase* P0)
{
	if (ParticleCount < Cell_PARTICLE_MAXIMUM)
		Particles[ParticleCount++] = P0;
	else
		CONSOLE_WARNING("Cell overflow");
}
void Cell::RemoveParticleUnsave(ParticleBase* P0)
{
	for (size_t i = 0; i < ParticleCount; ++i)
	if (Particles[i] == P0)
	{
		ParticleCount--;
		if (i < (ParticleCount + 1))//Es muss sortiert werden wenn das eintrifft!
			Particles[i] = Particles[ParticleCount];
		return;
	}
}


//partikelkollisionen
void Cell::CollisionOwnCell(ParticleBase* P0)
{
	ASSUME(this->ParticleCount <= Cell_PARTICLE_MAXIMUM);
	for (size_t i = 0; i < ParticleCount; ++i)
	if (P0 != Particles[i])
		P0->CollisionPerform(Particles[i]);
}
void Cell::CollisionOtherCell(ParticleBase* P0)
{
	ASSUME(this->ParticleCount <= Cell_PARTICLE_MAXIMUM);
	for (size_t i = 0; i < ParticleCount; ++i)
		P0->CollisionPerform(Particles[i]);
}
*/